home *** CD-ROM | disk | FTP | other *** search
/ The Arsenal Files 8 / The Arsenal Files Collection #8 (Arsenal Computer) (1996).ISO / g_quake / campkill.zip / CLIENT.QC < prev    next >
Text File  |  1996-08-22  |  37KB  |  1,567 lines

  1.  
  2. // prototypes
  3. void () W_WeaponFrame;
  4. void() W_SetCurrentAmmo;
  5. void() player_pain;
  6. void() player_stand1;
  7. void() GibPlayer;        //MRB to kill camper
  8. void() DeathSound;
  9. void (vector org) spawn_tfog;
  10. void (vector org, entity death_owner) spawn_tdeath;
  11.  
  12. float modelindex_eyes, modelindex_player;
  13. float rlevel;
  14.  
  15. /*=============================================================================
  16.  
  17.                 LEVEL CHANGING / INTERMISSION
  18.  
  19. =============================================================================*/
  20.  
  21. float    intermission_running;
  22. float    intermission_exittime;
  23.  
  24. /*QUAKED info_intermission (1 0.5 0.5) (-16 -16 -16) (16 16 16)
  25. This is the camera point for the intermission.
  26. Use mangle instead of angle, so you can set pitch or roll as well as yaw.  'pitch roll yaw'
  27. */
  28. void() info_intermission =
  29. {
  30. };
  31.  
  32.  
  33.  
  34. void() SetChangeParms =
  35. {
  36. // remove items
  37.     self.items = self.items - (self.items & 
  38.     (IT_KEY1 | IT_KEY2 | IT_INVISIBILITY | IT_INVULNERABILITY | IT_SUIT | IT_QUAD) );
  39.     
  40. // cap super health
  41.     if (self.health > 100)
  42.         self.health = 100;
  43.     if (self.health < 50)
  44.         self.health = 50;
  45.     parm1 = self.items;
  46.     parm2 = self.health;
  47.     parm3 = self.armorvalue;
  48.     if (self.ammo_shells < 25)
  49.         parm4 = 25;
  50.     else
  51.         parm4 = self.ammo_shells;
  52.     parm5 = self.ammo_nails;
  53.     parm6 = self.ammo_rockets;
  54.     parm7 = self.ammo_cells;
  55.     parm8 = self.weapon;
  56.     parm9 = self.armortype * 100;
  57. };
  58.  
  59. void() SetNewParms =
  60. {
  61.     parm1 = IT_SHOTGUN | IT_AXE;
  62.     parm2 = 100;
  63.     parm3 = 0;
  64.     parm4 = 25;
  65.     parm5 = 0;
  66.     parm6 = 0;
  67.     parm6 = 0;
  68.     parm8 = 1;
  69.     parm9 = 0;
  70. };
  71.  
  72. void() DecodeLevelParms =
  73. {
  74.     if (serverflags)
  75.     {
  76.         if (world.model == "maps/start.bsp")
  77.             SetNewParms ();        // take away all stuff on starting new episode
  78.     }
  79.     
  80.     self.items = parm1;
  81.     self.health = parm2;
  82.     self.armorvalue = parm3;
  83.     self.ammo_shells = parm4;
  84.     self.ammo_nails = parm5;
  85.     self.ammo_rockets = parm6;
  86.     self.ammo_cells = parm7;
  87.     self.weapon = parm8;
  88.     self.armortype = parm9 * 0.01;
  89. };
  90.  
  91. /*
  92. ============
  93. FindIntermission
  94.  
  95. Returns the entity to view from
  96. ============
  97. */
  98. entity() FindIntermission =
  99. {
  100.     local    entity spot;
  101.     local    float cyc;
  102.  
  103. // look for info_intermission first
  104.     spot = find (world, classname, "info_intermission");
  105.     if (spot)
  106.     {    // pick a random one
  107.         cyc = random() * 4;
  108.         while (cyc > 1)
  109.         {
  110.             spot = find (spot, classname, "info_intermission");
  111.             if (!spot)
  112.                 spot = find (spot, classname, "info_intermission");
  113.             cyc = cyc - 1;
  114.         }
  115.         return spot;
  116.     }
  117.  
  118. // then look for the start position
  119.     spot = find (world, classname, "info_player_start");
  120.     if (spot)
  121.         return spot;
  122.     
  123. // testinfo_player_start is only found in regioned levels
  124.     spot = find (world, classname, "testplayerstart");
  125.     if (spot)
  126.         return spot;
  127.     
  128.     objerror ("FindIntermission: no spot");
  129. };
  130.  
  131.  
  132. string nextmap;
  133. string nextmapstr;
  134. void() GotoNextMap =
  135. {
  136.     if (cvar("samelevel"))    // if samelevel is set, stay on same level
  137.         changelevel (mapname);
  138.     else
  139.  
  140. /* LEVEL RANDOMIZER BY MRB*/
  141.  
  142.         {
  143.         rlevel = rint(random() * 18);
  144.  
  145.             if (rlevel == 0) {
  146.                 nextmap = "e1m6";
  147.                 nextmapstr = "The Door To Chthon"; }
  148.             if (rlevel == 1) {
  149.                 nextmap = "dm2";
  150.                 nextmapstr = "Claustrophobopolis"; }
  151.             if (rlevel == 2) {
  152.                 nextmap = "e4m1";
  153.                 nextmapstr = "The Sewage System"; }
  154.             if (rlevel == 3) {
  155.                 nextmap = "dm6";
  156.                 nextmapstr = "The Dark Zone"; }
  157.             if (rlevel == 4) {
  158.                 nextmap = "e1m4";
  159.                 nextmapstr = "The Grisly Grotto"; }
  160.             if (rlevel == 5) {
  161.                 nextmap = "dm5";
  162.                 nextmapstr = "The Cistern"; }
  163.             if (rlevel == 6) {
  164.                 nextmap = "e1m3";
  165.                 nextmapstr = "The Necropolis"; }
  166.             if (rlevel == 7) {
  167.                 nextmap = "e2m6";
  168.                 nextmapstr = "The Dismal Oubliette"; }
  169.             if (rlevel == 8) {
  170.                 nextmap = "dm3";
  171.                 nextmapstr = "The Abandoned Base"; }
  172.             if (rlevel == 9) {
  173.                 nextmap = "dm1";
  174.                 nextmapstr = "Place of Two Deaths"; }
  175.             if (rlevel == 10) {
  176.                 nextmap = "e4m5";
  177.                 nextmapstr = "Hell's Atrium"; }
  178.             if (rlevel == 11) {
  179.                 nextmap = "dm4";
  180.                 nextmapstr = "The Bad Place"; }
  181.             if (rlevel == 12) {
  182.                 nextmap = "start";
  183.                 nextmapstr = "Welcome to Quake"; }
  184.             if (rlevel == 13) {
  185.                 nextmap = "e4m2";
  186.                 nextmapstr = "The Tower of Despair"; }
  187.             if (rlevel == 14) {
  188.                 nextmap = "e1m2";
  189.                 nextmapstr = "Castle of the Damned"; }
  190.             if (rlevel == 15) {
  191.                 nextmap = "e1m7";
  192.                 nextmapstr = "The House of Chthon"; }
  193.             if (rlevel == 16) {
  194.                 nextmap = "e2m1";
  195.                 nextmapstr = "The Installation"; }
  196.             if (rlevel == 17) {
  197.                 nextmap = "e3m3";
  198.                 nextmapstr = "The Tomb of Terror"; }
  199.             if (rlevel == 18) {
  200.                 nextmap = "e1m5";
  201.                 nextmapstr = "Gloom Keep "; }
  202.  
  203.             sprint (self,"The Next level is : ");
  204.             sprint(self, nextmapstr);   sprint(self, "\n");
  205.  
  206.             bprint("The Next level is : ");
  207.             bprint(nextmapstr); bprint("\n");
  208.             changelevel (nextmap);
  209.         }
  210. };
  211.  
  212.  
  213. void() ExitIntermission =
  214. {
  215. // skip any text in deathmatch
  216.     if (deathmatch)
  217.     {
  218.         GotoNextMap ();
  219.         return;
  220.     }
  221.     
  222.     intermission_exittime = time + 1;
  223.     intermission_running = intermission_running + 1;
  224.  
  225. //
  226. // run some text if at the end of an episode
  227. //
  228.     if (intermission_running == 2)
  229.     {
  230.         if (world.model == "maps/e1m7.bsp")
  231.         {
  232.             WriteByte (MSG_ALL, SVC_CDTRACK);
  233.             WriteByte (MSG_ALL, 2);
  234.             WriteByte (MSG_ALL, 3);
  235.             if (!cvar("registered"))
  236.             {
  237.                 WriteByte (MSG_ALL, SVC_FINALE);
  238.                 WriteString (MSG_ALL, "As the corpse of the monstrous entity\nChthon sinks back into the lava whence\nit rose, you grip the Rune of Earth\nMagic tightly. Now that you have\nconquered the Dimension of the Doomed,\nrealm of Earth Magic, you are ready to\ncomplete your task in the other three\nhaunted lands of Quake. Or are you? If\nyou don't register Quake, you'll never\nknow what awaits you in the Realm of\nBlack Magic, the Netherworld, and the\nElder World!");
  239.             }
  240.             else
  241.             {
  242.                 WriteByte (MSG_ALL, SVC_FINALE);
  243.                 WriteString (MSG_ALL, "As the corpse of the monstrous entity\nChthon sinks back into the lava whence\nit rose, you grip the Rune of Earth\nMagic tightly. Now that you have\nconquered the Dimension of the Doomed,\nrealm of Earth Magic, you are ready to\ncomplete your task. A Rune of magic\npower lies at the end of each haunted\nland of Quake. Go forth, seek the\ntotality of the four Runes!");
  244.             }
  245.             return;
  246.         }
  247.         else if (world.model == "maps/e2m6.bsp")
  248.         {
  249.             WriteByte (MSG_ALL, SVC_CDTRACK);
  250.             WriteByte (MSG_ALL, 2);
  251.             WriteByte (MSG_ALL, 3);
  252.  
  253.             WriteByte (MSG_ALL, SVC_FINALE);
  254.             WriteString (MSG_ALL, "The Rune of Black Magic throbs evilly in\nyour hand and whispers dark thoughts\ninto your brain. You learn the inmost\nlore of the Hell-Mother; Shub-Niggurath!\nYou now know that she is behind all the\nterrible plotting which has led to so\nmuch death and horror. But she is not\ninviolate! Armed with this Rune, you\nrealize that once all four Runes are\ncombined, the gate to Shub-Niggurath's\nPit will open, and you can face the\nWitch-Goddess herself in her frightful\notherworld cathedral.");
  255.             return;
  256.         }
  257.         else if (world.model == "maps/e3m6.bsp")
  258.         {
  259.             WriteByte (MSG_ALL, SVC_CDTRACK);
  260.             WriteByte (MSG_ALL, 2);
  261.             WriteByte (MSG_ALL, 3);
  262.  
  263.             WriteByte (MSG_ALL, SVC_FINALE);
  264.             WriteString (MSG_ALL, "The charred viscera of diabolic horrors\nbubble viscously as you seize the Rune\nof Hell Magic. Its heat scorches your\nhand, and its terrible secrets blight\nyour mind. Gathering the shreds of your\ncourage, you shake the devil's shackles\nfrom your soul, and become ever more\nhard and determined to destroy the\nhideous creatures whose mere existence\nthreatens the souls and psyches of all\nthe population of Earth.");
  265.             return;
  266.         }
  267.         else if (world.model == "maps/e4m7.bsp")
  268.         {
  269.             WriteByte (MSG_ALL, SVC_CDTRACK);
  270.             WriteByte (MSG_ALL, 2);
  271.             WriteByte (MSG_ALL, 3);
  272.  
  273.             WriteByte (MSG_ALL, SVC_FINALE);
  274.             WriteString (MSG_ALL, "Despite the awful might of the Elder\nWorld, you have achieved the Rune of\nElder Magic, capstone of all types of\narcane wisdom. Beyond good and evil,\nbeyond life and death, the Rune\npulsates, heavy with import. Patient and\npotent, the Elder Being Shub-Niggurath\nweaves her dire plans to clear off all\nlife from the Earth, and bring her own\nfoul offspring to our world! For all the\ndwellers in these nightmare dimensions\nare her descendants! Once all Runes of\nmagic power are united, the energy\nbehind them will blast open the Gateway\nto Shub-Niggurath, and you can travel\nthere to foil the Hell-Mother's plots\nin person.");
  275.             return;
  276.         }
  277.  
  278.         GotoNextMap();
  279.     }
  280.     
  281.     if (intermission_running == 3)
  282.     {
  283.         if (!cvar("registered"))
  284.         {    // shareware episode has been completed, go to sell screen
  285.             WriteByte (MSG_ALL, SVC_SELLSCREEN);
  286.             return;
  287.         }
  288.         
  289.         if ( (serverflags&15) == 15)
  290.         {
  291.             WriteByte (MSG_ALL, SVC_FINALE);
  292.             WriteString (MSG_ALL, "Now, you have all four Runes. You sense\ntremendous invisible forces moving to\nunseal ancient barriers. Shub-Niggurath\nhad hoped to use the Runes Herself to\nclear off the Earth, but now instead,\nyou will use them to enter her home and\nconfront her as an avatar of avenging\nEarth-life. If you defeat her, you will\nbe remembered forever as the savior of\nthe planet. If she conquers, it will be\nas if you had never been born.");
  293.             return;
  294.         }
  295.         
  296.     }
  297.  
  298.     GotoNextMap();
  299. };
  300.  
  301. /*
  302. ============
  303. IntermissionThink
  304.  
  305. When the player presses attack or jump, change to the next level
  306. ============
  307. */
  308. void() IntermissionThink =
  309. {
  310.     if (time < intermission_exittime)
  311.         return;
  312.  
  313.     if (!self.button0 && !self.button1 && !self.button2)
  314.         return;
  315.     
  316.     ExitIntermission ();
  317. };
  318.  
  319. void() execute_changelevel =
  320. {
  321.     local entity    pos;
  322.  
  323.     intermission_running = 1;
  324.     
  325. // enforce a wait time before allowing changelevel
  326.     if (deathmatch)
  327.         intermission_exittime = time + 5;
  328.     else
  329.         intermission_exittime = time + 2;
  330.  
  331.     WriteByte (MSG_ALL, SVC_CDTRACK);
  332.     WriteByte (MSG_ALL, 3);
  333.     WriteByte (MSG_ALL, 3);
  334.     
  335.     pos = FindIntermission ();
  336.  
  337.     other = find (world, classname, "player");
  338.     while (other != world)
  339.     {
  340.         other.view_ofs = '0 0 0';
  341.         other.angles = other.v_angle = pos.mangle;
  342.         other.fixangle = TRUE;        // turn this way immediately
  343.         other.nextthink = time + 0.5;
  344.         other.takedamage = DAMAGE_NO;
  345.         other.solid = SOLID_NOT;
  346.         other.movetype = MOVETYPE_NONE;
  347.         other.modelindex = 0;
  348.         setorigin (other, pos.origin);
  349.         other = find (other, classname, "player");
  350.     }    
  351.  
  352.     WriteByte (MSG_ALL, SVC_INTERMISSION);
  353. };
  354.  
  355.  
  356. void() changelevel_touch =
  357. {
  358.     local entity    pos;
  359.  
  360.     if (other.classname != "player")
  361.         return;
  362.  
  363.     if (cvar("noexit"))
  364.     {
  365.         T_Damage (other, self, self, 50000);
  366.         return;
  367.     }
  368.     bprint (other.netname);
  369.     bprint (" exited the level\n");
  370.     
  371.     nextmap = self.map;
  372.  
  373.     SUB_UseTargets ();
  374.  
  375.     if ( (self.spawnflags & 1) && (deathmatch == 0) )
  376.     {    // NO_INTERMISSION
  377.         GotoNextMap();
  378.         return;
  379.     }
  380.     
  381.     self.touch = SUB_Null;
  382.  
  383. // we can't move people right now, because touch functions are called
  384. // in the middle of C movement code, so set a think time to do it
  385.     self.think = execute_changelevel;
  386.     self.nextthink = time + 0.1;
  387. };
  388.  
  389. /*QUAKED trigger_changelevel (0.5 0.5 0.5) ? NO_INTERMISSION
  390. When the player touches this, he gets sent to the map listed in the "map" variable.  Unless the NO_INTERMISSION flag is set, the view will go to the info_intermission spot and display stats.
  391. */
  392. void() trigger_changelevel =
  393. {
  394.     if (!self.map)
  395.         objerror ("chagnelevel trigger doesn't have map");
  396.     
  397.     InitTrigger ();
  398.     self.touch = changelevel_touch;
  399. };
  400.  
  401.  
  402. /*
  403. =============================================================================
  404.  
  405.                 PLAYER GAME EDGE FUNCTIONS
  406.  
  407. =============================================================================
  408. */
  409.  
  410. void() set_suicide_frame;
  411.  
  412. // called by ClientKill and DeadThink
  413. void() respawn =
  414. {
  415.     if (coop)
  416.     {
  417.         // make a copy of the dead body for appearances sake
  418.         CopyToBodyQue (self);
  419.         // get the spawn parms as they were at level start
  420.         setspawnparms (self);
  421.         // respawn        
  422.         PutClientInServer ();
  423.     }
  424.     else if (deathmatch)
  425.     {
  426.         // make a copy of the dead body for appearances sake
  427.         CopyToBodyQue (self);
  428.         // set default spawn parms
  429.         SetNewParms ();
  430.         // respawn        
  431.         PutClientInServer ();
  432.     }
  433.     else
  434.     {    // restart the entire server
  435.         localcmd ("restart\n");
  436.     }
  437. };
  438.  
  439.  
  440. /*
  441. ============
  442. ClientKill
  443.  
  444. Player entered the suicide command
  445. ============
  446. */
  447. void() ClientKill =
  448. {
  449.     bprint (self.netname);
  450.     bprint (" suicides\n");
  451.     set_suicide_frame ();
  452.     self.modelindex = modelindex_player;
  453.     self.frags = self.frags - 2;    // extra penalty
  454.     respawn ();
  455. };
  456.  
  457. float(vector v) CheckSpawnPoint =
  458. {
  459.     return FALSE;
  460. };
  461.  
  462. /*
  463. ============
  464. SelectSpawnPoint
  465.  
  466. Returns the entity to spawn at
  467. ============
  468. */
  469. entity() SelectSpawnPoint =
  470. {
  471.     local    entity spot;
  472.     
  473. // testinfo_player_start is only found in regioned levels
  474.     spot = find (world, classname, "testplayerstart");
  475.     if (spot)
  476.         return spot;
  477.         
  478. // choose a info_player_deathmatch point
  479.     if (coop)
  480.     {
  481.         lastspawn = find(lastspawn, classname, "info_player_coop");
  482.         if (lastspawn == world)
  483.             lastspawn = find (lastspawn, classname, "info_player_start");
  484.         if (lastspawn != world)
  485.             return lastspawn;
  486.     }
  487.     else if (deathmatch)
  488.     {
  489.         lastspawn = find(lastspawn, classname, "info_player_deathmatch");
  490.         if (lastspawn == world)
  491.             lastspawn = find (lastspawn, classname, "info_player_deathmatch");
  492.         if (lastspawn != world)
  493.             return lastspawn;
  494.     }
  495.  
  496.     if (serverflags)
  497.     {    // return with a rune to start
  498.         spot = find (world, classname, "info_player_start2");
  499.         if (spot)
  500.             return spot;
  501.     }
  502.     
  503.     spot = find (world, classname, "info_player_start");
  504.     if (!spot)
  505.         error ("PutClientInServer: no info_player_start on level");
  506.     
  507.     return spot;
  508. };
  509.  
  510. /*
  511. ===========
  512. PutClientInServer
  513.  
  514. called each time a player is spawned
  515. ============
  516. */
  517. void() DecodeLevelParms;
  518. void() PlayerDie;
  519.  
  520.  
  521. void() PutClientInServer =
  522. {
  523.     local    entity spot;
  524.  
  525.     self.classname = "player";
  526.     self.health = 100;
  527.     self.takedamage = DAMAGE_AIM;
  528.     self.solid = SOLID_SLIDEBOX;
  529.     self.movetype = MOVETYPE_WALK;
  530.     self.show_hostile = 0;
  531.     self.max_health = 100;
  532.     self.flags = FL_CLIENT;
  533.     self.air_finished = time + 12;
  534.     self.dmg = 2;           // initial water damage
  535.     self.super_damage_finished = 0;
  536.     self.radsuit_finished = 0;
  537.     self.invisible_finished = 0;
  538.     self.invincible_finished = 0;
  539.     self.effects = 0;
  540.     self.invincible_time = 0;
  541.  
  542.     DecodeLevelParms ();
  543.     
  544.     W_SetCurrentAmmo ();
  545.  
  546.     self.attack_finished = time;
  547.     self.th_pain = player_pain;
  548.     self.th_die = PlayerDie;
  549.     
  550.     self.deadflag = DEAD_NO;
  551. // paustime is set by teleporters to keep the player from moving a while
  552.     self.pausetime = 0;
  553.     
  554.     spot = SelectSpawnPoint ();
  555.  
  556.     self.origin = spot.origin + '0 0 1';
  557.     self.angles = spot.angles;
  558.     self.fixangle = TRUE;        // turn this way immediately
  559.  
  560. // oh, this is a hack!
  561.     setmodel (self, "progs/eyes.mdl");
  562.     modelindex_eyes = self.modelindex;
  563.  
  564.     setmodel (self, "progs/player.mdl");
  565.     modelindex_player = self.modelindex;
  566.  
  567.     setsize (self, VEC_HULL_MIN, VEC_HULL_MAX);
  568.     
  569.     self.view_ofs = '0 0 22';
  570.  
  571.     player_stand1 ();
  572.     
  573.     if (deathmatch || coop)
  574.     {
  575.         makevectors(self.angles);
  576.         spawn_tfog (self.origin + v_forward*20);
  577.     }
  578.  
  579.     spawn_tdeath (self.origin, self);
  580. };
  581.  
  582.  
  583. /*
  584. =============================================================================
  585.  
  586.                 QUAKED FUNCTIONS
  587.  
  588. =============================================================================
  589. */
  590.  
  591.  
  592. /*QUAKED info_player_start (1 0 0) (-16 -16 -24) (16 16 24)
  593. The normal starting point for a level.
  594. */
  595. void() info_player_start =
  596. {
  597. };
  598.  
  599.  
  600. /*QUAKED info_player_start2 (1 0 0) (-16 -16 -24) (16 16 24)
  601. Only used on start map for the return point from an episode.
  602. */
  603. void() info_player_start2 =
  604. {
  605. };
  606.  
  607.  
  608. /*
  609. saved out by quaked in region mode
  610. */
  611. void() testplayerstart =
  612. {
  613. };
  614.  
  615. /*QUAKED info_player_deathmatch (1 0 1) (-16 -16 -24) (16 16 24)
  616. potential spawning position for deathmatch games
  617. */
  618. void() info_player_deathmatch =
  619. {
  620. };
  621.  
  622. /*QUAKED info_player_coop (1 0 1) (-16 -16 -24) (16 16 24)
  623. potential spawning position for coop games
  624. */
  625. void() info_player_coop =
  626. {
  627. };
  628.  
  629. /*
  630. ===============================================================================
  631.  
  632. RULES
  633.  
  634. ===============================================================================
  635. */
  636.  
  637. void(entity c) PrintClientScore =
  638. {
  639.     if (c.frags > -10 && c.frags < 0)
  640.         bprint (" ");
  641.     else if (c.frags >= 0)
  642.     {
  643.         if (c.frags < 100)
  644.             bprint (" ");
  645.         if (c.frags < 10)
  646.             bprint (" ");
  647.     }
  648.     bprint (ftos(c.frags));
  649.     bprint (" ");
  650.     bprint (c.netname);
  651.     bprint ("\n");
  652. };
  653.  
  654. void() DumpScore =
  655. {
  656.     local entity    e, sort, walk;
  657.  
  658.     if (world.chain)
  659.         error ("DumpScore: world.chain is set");
  660.  
  661. // build a sorted lis
  662.     e = find(world, classname, "player");
  663.     sort = world;
  664.     while (e)
  665.     {
  666.         if (!sort)
  667.         {
  668.             sort = e;
  669.             e.chain = world;
  670.         }
  671.         else
  672.         {
  673.             if (e.frags > sort.frags)
  674.             {
  675.                 e.chain = sort;
  676.                 sort = e;
  677.             }
  678.             else
  679.             {
  680.                 walk = sort;
  681.                 do
  682.                 {
  683.                     if (!walk.chain)
  684.                     {
  685.                         e.chain = world;
  686.                         walk.chain = e;
  687.                     }
  688.                     else if (walk.chain.frags < e.frags)
  689.                     {
  690.                         e.chain = walk.chain;
  691.                         walk.chain = e;
  692.                     }
  693.                     else
  694.                         walk = walk.chain;
  695.                 } while (walk.chain != e);
  696.             }
  697.         }
  698.         
  699.         e = find(e, classname, "player");
  700.     }
  701.  
  702. // print the list
  703.     
  704.     bprint ("\n");    
  705.     while (sort)
  706.     {
  707.         PrintClientScore (sort);
  708.         sort = sort.chain;
  709.     }
  710.     bprint ("\n");
  711. };
  712.  
  713. /*
  714. go to the next level for deathmatch
  715. */
  716. void() NextLevel =
  717. {
  718.     local entity o;
  719.  
  720. // find a trigger changelevel
  721.     o = find(world, classname, "trigger_changelevel");
  722.     if (!o || mapname == "start")
  723.     {    // go back to same map if no trigger_changelevel
  724.         o = spawn();
  725.         o.map = mapname;
  726.     }
  727.  
  728.     nextmap = o.map;
  729.     
  730.     if (o.nextthink < time)
  731.     {
  732.         o.think = execute_changelevel;
  733.         o.nextthink = time + 0.1;
  734.     }
  735. };
  736.  
  737. /*
  738. ============
  739. CheckRules
  740.  
  741. Exit deathmatch games upon conditions
  742. ============
  743. */
  744. void() CheckRules =
  745. {
  746.     local    float        timelimit;
  747.     local    float        fraglimit;
  748.     
  749.     if (gameover)    // someone else quit the game already
  750.         return;
  751.         
  752.     timelimit = cvar("timelimit") * 60;
  753.     fraglimit = cvar("fraglimit");
  754.     
  755.     if (timelimit && time >= timelimit)
  756.     {
  757. NextLevel ();
  758. /*
  759.         gameover = TRUE;
  760.         bprint ("\n\n\n==============================\n");
  761.         bprint ("game exited after ");
  762.         bprint (ftos(timelimit/60));
  763.         bprint (" minutes\n");
  764.         DumpScore ();
  765.         localcmd ("killserver\n");
  766. */
  767.         return;
  768.     }
  769.     
  770.     if (fraglimit && self.frags >= fraglimit)
  771.     {
  772. NextLevel ();
  773. /*
  774.         gameover = TRUE;
  775.         bprint ("\n\n\n==============================\n");
  776.         bprint ("game exited after ");
  777.         bprint (ftos(self.frags));
  778.         bprint (" frags\n");
  779.         DumpScore ();
  780.         localcmd ("killserver\n");
  781. */
  782.         return;
  783.     }    
  784. };
  785.  
  786. //============================================================================
  787.  
  788. void() PlayerDeathThink =
  789. {
  790.     local entity    old_self;
  791.     local float        forward;
  792.  
  793.     if ((self.flags & FL_ONGROUND))
  794.     {
  795.         forward = vlen (self.velocity);
  796.         forward = forward - 20;
  797.         if (forward <= 0)
  798.             self.velocity = '0 0 0';
  799.         else    
  800.             self.velocity = forward * normalize(self.velocity);
  801.     }
  802.  
  803. // wait for all buttons released
  804.     if (self.deadflag == DEAD_DEAD)
  805.     {
  806.         if (self.button2 || self.button1 || self.button0)
  807.             return;
  808.         self.deadflag = DEAD_RESPAWNABLE;
  809.         return;
  810.     }
  811.  
  812. // wait for any button down
  813.     if (!self.button2 && !self.button1 && !self.button0)
  814.         return;
  815.  
  816.     self.button0 = 0;
  817.     self.button1 = 0;
  818.     self.button2 = 0;
  819.     respawn();
  820. };
  821.  
  822.  
  823. void() PlayerJump =
  824. {
  825.     local vector start, end;
  826.     
  827.     if (self.flags & FL_WATERJUMP)
  828.         return;
  829.     
  830.     if (self.waterlevel >= 2)
  831.     {
  832.         if (self.watertype == CONTENT_WATER)
  833.             self.velocity_z = 100;
  834.         else if (self.watertype == CONTENT_SLIME)
  835.             self.velocity_z = 80;
  836.         else
  837.             self.velocity_z = 50;
  838.  
  839. // play swiming sound
  840.         if (self.swim_flag < time)
  841.         {
  842.             self.swim_flag = time + 1;
  843.             if (random() < 0.5)
  844.                 sound (self, CHAN_BODY, "misc/water1.wav", 1, ATTN_NORM);
  845.             else
  846.                 sound (self, CHAN_BODY, "misc/water2.wav", 1, ATTN_NORM);
  847.         }
  848.  
  849.         return;
  850.     }
  851.  
  852.     if (!(self.flags & FL_ONGROUND))
  853.         return;
  854.  
  855.     if ( !(self.flags & FL_JUMPRELEASED) )
  856.         return;        // don't pogo stick
  857.  
  858.     self.flags = self.flags - (self.flags & FL_JUMPRELEASED);
  859.  
  860.     self.flags = self.flags - FL_ONGROUND;    // don't stairwalk
  861.     
  862.     self.button2 = 0;
  863. // player jumping sound
  864.     sound (self, CHAN_BODY, "player/plyrjmp8.wav", 1, ATTN_NORM);
  865.     self.velocity_z = self.velocity_z + 270;
  866. };
  867.  
  868.  
  869. /*
  870. ===========
  871. WaterMove
  872.  
  873. ============
  874. */
  875. .float    dmgtime;
  876.  
  877. void() WaterMove =
  878. {
  879. //dprint (ftos(self.waterlevel));
  880.     if (self.movetype == MOVETYPE_NOCLIP)
  881.         return;
  882.     if (self.health < 0)
  883.         return;
  884.  
  885.     if (self.waterlevel != 3)
  886.     {
  887.         if (self.air_finished < time)
  888.             sound (self, CHAN_VOICE, "player/gasp2.wav", 1, ATTN_NORM);
  889.         else if (self.air_finished < time + 9)
  890.             sound (self, CHAN_VOICE, "player/gasp1.wav", 1, ATTN_NORM);
  891.         self.air_finished = time + 12;
  892.         self.dmg = 2;
  893.     }
  894.     else if (self.air_finished < time)
  895.     {    // drown!
  896.         if (self.pain_finished < time)
  897.         {
  898.             self.dmg = self.dmg + 2;
  899.             if (self.dmg > 15)
  900.                 self.dmg = 10;
  901.             T_Damage (self, world, world, self.dmg);
  902.             self.pain_finished = time + 1;
  903.         }
  904.     }
  905.     
  906.     if (!self.waterlevel)
  907.     {
  908.         if (self.flags & FL_INWATER)
  909.         {    
  910.             // play leave water sound
  911.             sound (self, CHAN_BODY, "misc/outwater.wav", 1, ATTN_NORM);
  912.             self.flags = self.flags - FL_INWATER;
  913.         }
  914.         return;
  915.     }
  916.  
  917.     if (self.watertype == CONTENT_LAVA)
  918.     {    // do damage
  919.         if (self.dmgtime < time)
  920.         {
  921.             if (self.radsuit_finished > time)
  922.                 self.dmgtime = time + 1;
  923.             else
  924.                 self.dmgtime = time + 0.2;
  925.  
  926.             T_Damage (self, world, world, 10*self.waterlevel);
  927.         }
  928.     }
  929.     else if (self.watertype == CONTENT_SLIME)
  930.     {    // do damage
  931.         if (self.dmgtime < time && self.radsuit_finished < time)
  932.         {
  933.             self.dmgtime = time + 1;
  934.             T_Damage (self, world, world, 4*self.waterlevel);
  935.         }
  936.     }
  937.     
  938.     if ( !(self.flags & FL_INWATER) )
  939.     {    
  940.  
  941. // player enter water sound
  942.  
  943.         if (self.watertype == CONTENT_LAVA)
  944.             sound (self, CHAN_BODY, "player/inlava.wav", 1, ATTN_NORM);
  945.         if (self.watertype == CONTENT_WATER)
  946.             sound (self, CHAN_BODY, "player/inh2o.wav", 1, ATTN_NORM);
  947.         if (self.watertype == CONTENT_SLIME)
  948.             sound (self, CHAN_BODY, "player/slimbrn2.wav", 1, ATTN_NORM);
  949.  
  950.         self.flags = self.flags + FL_INWATER;
  951.         self.dmgtime = 0;
  952.     }
  953.     
  954.     if (! (self.flags & FL_WATERJUMP) )
  955.         self.velocity = self.velocity - 0.8*self.waterlevel*frametime*self.velocity;
  956. };
  957.  
  958. void() CheckWaterJump =
  959. {
  960.     local vector start, end;
  961.  
  962. // check for a jump-out-of-water
  963.     makevectors (self.angles);
  964.     start = self.origin;
  965.     start_z = start_z + 8; 
  966.     v_forward_z = 0;
  967.     normalize(v_forward);
  968.     end = start + v_forward*24;
  969.     traceline (start, end, TRUE, self);
  970.     if (trace_fraction < 1)
  971.     {    // solid at waist
  972.         start_z = start_z + self.maxs_z - 8;
  973.         end = start + v_forward*24;
  974.         self.movedir = trace_plane_normal * -50;
  975.         traceline (start, end, TRUE, self);
  976.         if (trace_fraction == 1)
  977.         {    // open at eye level
  978.             self.flags = self.flags | FL_WATERJUMP;
  979.             self.velocity_z = 225;
  980.             self.flags = self.flags - (self.flags & FL_JUMPRELEASED);
  981.             self.teleport_time = time + 2;    // safety net
  982.             return;
  983.         }
  984.     }
  985. };
  986.  
  987.  
  988. /*
  989. ================
  990. PlayerPreThink
  991.  
  992. Called every frame before physics are run
  993. ================
  994. */
  995. void() PlayerPreThink =
  996. {
  997.     local    float    mspeed, aspeed;
  998.     local    float    r;
  999.     local float rs;
  1000.  
  1001.     if (intermission_running)
  1002.     {
  1003.         IntermissionThink ();    // otherwise a button could be missed between
  1004.         return;                    // the think tics
  1005.     }
  1006.  
  1007.     if (self.view_ofs == '0 0 0')
  1008.         return;        // intermission or finale
  1009.  
  1010.     makevectors (self.v_angle);        // is this still used
  1011.  
  1012.     CheckRules ();
  1013.     WaterMove ();
  1014.  
  1015.     if (self.waterlevel == 2)
  1016.         CheckWaterJump ();
  1017.  
  1018.     if (self.deadflag >= DEAD_DEAD)
  1019.     {
  1020.         PlayerDeathThink ();
  1021.         return;
  1022.     }
  1023.  
  1024. //START: Camper killer MRB96
  1025.    if(self.MoveBy != 0 && self.MoveBy <= time)
  1026.       {
  1027. // gib
  1028.     if(self.campcount < 3)
  1029.     {       
  1030. /*       if (self.health > 90)    //If player is fit make hime ill :-)
  1031.             self.health = 20;        
  1032.        else                //If he's ill make hime REAL ill ;-)
  1033.         self.health = 5;
  1034. */  
  1035.     self.MoveBy = self.MoveBy + 2;    //allows 2seconds for a movement
  1036.     self.campcount = self.campcount + 1;
  1037.  
  1038.     bprint("Camper Alert: ");     bprint(self.netname);        
  1039.     if (self.campcount == 1)
  1040.         bprint(" : Strike1! \n");
  1041.     if (self.campcount == 2)
  1042.         bprint(" : Strike2! \n");
  1043.     if (self.campcount == 3)
  1044.         bprint(" : Strike3! \n");
  1045.  
  1046.     rs = rint((random() * 5) + 1);        // If he's ill scream!
  1047.     self.noise = "";
  1048.     if (rs == 1)
  1049.         self.noise = "player/pain1.wav";
  1050.     else if (rs == 2)
  1051.         self.noise = "player/pain2.wav";
  1052.     else if (rs == 3)
  1053.         self.noise = "player/pain3.wav";
  1054.     else if (rs == 4)
  1055.         self.noise = "player/pain4.wav";
  1056.     else if (rs == 5)
  1057.         self.noise = "player/pain5.wav";
  1058.     else
  1059.         self.noise = "player/pain6.wav";
  1060.     sound (self, CHAN_VOICE, self.noise, 1, ATTN_NORM);
  1061.  
  1062.     }
  1063.     else
  1064.     {
  1065.         self.health = 0;    //KILL
  1066.         self.MoveBy = 0;    //reset movement counter
  1067.             GibPlayer();
  1068.         bprint(self.netname);
  1069.         bprint(" was Gibbed for being a WussBoy Camper!\n");          
  1070.         DeathSound();
  1071.         self.campcount = 0;    //reset camper-counter
  1072.     }
  1073.       }
  1074.  
  1075. //END MRB
  1076.  
  1077.     if (self.deadflag == DEAD_DYING)
  1078.         return;    // dying, so do nothing
  1079.  
  1080.     if (self.button2)
  1081.     {
  1082.         PlayerJump ();
  1083.     }
  1084.     else
  1085.         self.flags = self.flags | FL_JUMPRELEASED;
  1086.  
  1087. // teleporters can force a non-moving pause time    
  1088.     if (time < self.pausetime)
  1089.         self.velocity = '0 0 0';
  1090. };
  1091.     
  1092. /*
  1093. ================
  1094. CheckPowerups
  1095.  
  1096. Check for turning off powerups
  1097. ================
  1098. */
  1099. void() CheckPowerups =
  1100. {
  1101.     if (self.health <= 0)
  1102.         return;
  1103.  
  1104. // invisibility
  1105.     if (self.invisible_finished)
  1106.     {
  1107. // sound and screen flash when items starts to run out
  1108.         if (self.invisible_sound < time)
  1109.         {
  1110.             sound (self, CHAN_AUTO, "items/inv3.wav", 0.5, ATTN_IDLE);
  1111.             self.invisible_sound = time + ((random() * 3) + 1);
  1112.         }
  1113.  
  1114.  
  1115.         if (self.invisible_finished < time + 3)
  1116.         {
  1117.             if (self.invisible_time == 1)
  1118.             {
  1119.                 sprint (self, "Ring of Shadows magic is fading\n");
  1120.                 stuffcmd (self, "bf\n");
  1121.                 sound (self, CHAN_AUTO, "items/inv2.wav", 1, ATTN_NORM);
  1122.                 self.invisible_time = time + 1;
  1123.             }
  1124.             
  1125.             if (self.invisible_time < time)
  1126.             {
  1127.                 self.invisible_time = time + 1;
  1128.                 stuffcmd (self, "bf\n");
  1129.             }
  1130.         }
  1131.  
  1132.         if (self.invisible_finished < time)
  1133.         {    // just stopped
  1134.             self.items = self.items - IT_INVISIBILITY;
  1135.             self.invisible_finished = 0;
  1136.             self.invisible_time = 0;
  1137.         }
  1138.         
  1139.     // use the eyes
  1140.         self.frame = 0;
  1141.         self.modelindex = modelindex_eyes;
  1142.     }
  1143.     else
  1144.         self.modelindex = modelindex_player;    // don't use eyes
  1145.  
  1146. // invincibility
  1147.     if (self.invincible_finished)
  1148.     {
  1149. // sound and screen flash when items starts to run out
  1150.         if (self.invincible_finished < time + 3)
  1151.         {
  1152.             if (self.invincible_time == 1)
  1153.             {
  1154.                 sprint (self, "Protection is almost burned out\n");
  1155.                 stuffcmd (self, "bf\n");
  1156.                 sound (self, CHAN_AUTO, "items/protect2.wav", 1, ATTN_NORM);
  1157.                 self.invincible_time = time + 1;
  1158.             }
  1159.             
  1160.             if (self.invincible_time < time)
  1161.             {
  1162.                 self.invincible_time = time + 1;
  1163.                 stuffcmd (self, "bf\n");
  1164.             }
  1165.         }
  1166.         
  1167.         if (self.invincible_finished < time)
  1168.         {    // just stopped
  1169.             self.items = self.items - IT_INVULNERABILITY;
  1170.             self.invincible_time = 0;
  1171.             self.invincible_finished = 0;
  1172.         }
  1173.         if (self.invincible_finished > time)
  1174.             self.effects = self.effects | EF_DIMLIGHT;
  1175.         else
  1176.             self.effects = self.effects - (self.effects & EF_DIMLIGHT);
  1177.     }
  1178.  
  1179. // super damage
  1180.     if (self.super_damage_finished)
  1181.     {
  1182.  
  1183. // sound and screen flash when items starts to run out
  1184.  
  1185.         if (self.super_damage_finished < time + 3)
  1186.         {
  1187.             if (self.super_time == 1)
  1188.             {
  1189.                 sprint (self, "Quad Damage is wearing off\n");
  1190.                 stuffcmd (self, "bf\n");
  1191.                 sound (self, CHAN_AUTO, "items/damage2.wav", 1, ATTN_NORM);
  1192.                 self.super_time = time + 1;
  1193.             }      
  1194.             
  1195.             if (self.super_time < time)
  1196.             {
  1197.                 self.super_time = time + 1;
  1198.                 stuffcmd (self, "bf\n");
  1199.             }
  1200.         }
  1201.  
  1202.         if (self.super_damage_finished < time)
  1203.         {    // just stopped
  1204.             self.items = self.items - IT_QUAD;
  1205.             self.super_damage_finished = 0;
  1206.             self.super_time = 0;
  1207.         }
  1208.         if (self.super_damage_finished > time)
  1209.             self.effects = self.effects | EF_DIMLIGHT;
  1210.         else
  1211.             self.effects = self.effects - (self.effects & EF_DIMLIGHT);
  1212.     }    
  1213.  
  1214. // suit    
  1215.     if (self.radsuit_finished)
  1216.     {
  1217.         self.air_finished = time + 12;        // don't drown
  1218.  
  1219. // sound and screen flash when items starts to run out
  1220.         if (self.radsuit_finished < time + 3)
  1221.         {
  1222.             if (self.rad_time == 1)
  1223.             {
  1224.                 sprint (self, "Air supply in Biosuit expiring\n");
  1225.                 stuffcmd (self, "bf\n");
  1226.                 sound (self, CHAN_AUTO, "items/suit2.wav", 1, ATTN_NORM);
  1227.                 self.rad_time = time + 1;
  1228.             }
  1229.             
  1230.             if (self.rad_time < time)
  1231.             {
  1232.                 self.rad_time = time + 1;
  1233.                 stuffcmd (self, "bf\n");
  1234.             }
  1235.         }
  1236.  
  1237.         if (self.radsuit_finished < time)
  1238.         {    // just stopped
  1239.             self.items = self.items - IT_SUIT;
  1240.             self.rad_time = 0;
  1241.             self.radsuit_finished = 0;
  1242.         }
  1243.     }    
  1244.  
  1245. };
  1246.  
  1247.  
  1248. /*
  1249. ================
  1250. PlayerPostThink
  1251.  
  1252. Called every frame after physics are run
  1253. ================
  1254. */
  1255. void() PlayerPostThink =
  1256. {
  1257.     local    float    mspeed, aspeed;
  1258.     local    float    r;
  1259.  
  1260.     if (self.view_ofs == '0 0 0')
  1261.         return;        // intermission or finale
  1262.     if (self.deadflag)
  1263.         return;
  1264.         
  1265. // do weapon stuff
  1266.  
  1267.     W_WeaponFrame ();
  1268.  
  1269. // check to see if player landed and play landing sound    
  1270.     if ((self.jump_flag < -300) && (self.flags & FL_ONGROUND) && (self.health > 0))
  1271.     {
  1272.         if (self.watertype == CONTENT_WATER)
  1273.             sound (self, CHAN_BODY, "player/h2ojump.wav", 1, ATTN_NORM);
  1274.         else if (self.jump_flag < -650)
  1275.         {
  1276.             T_Damage (self, world, world, 5); 
  1277.             sound (self, CHAN_VOICE, "player/land2.wav", 1, ATTN_NORM);
  1278.             self.deathtype = "falling";
  1279.         }
  1280.         else
  1281.             sound (self, CHAN_VOICE, "player/land.wav", 1, ATTN_NORM);
  1282.  
  1283.         self.jump_flag = 0;
  1284.     }
  1285.  
  1286.     if (!(self.flags & FL_ONGROUND))
  1287.         self.jump_flag = self.velocity_z;
  1288.  
  1289.     CheckPowerups ();
  1290. };
  1291.  
  1292.  
  1293. /*
  1294. ===========
  1295. ClientConnect
  1296.  
  1297. called when a player connects to a server
  1298. ============
  1299. */
  1300. void() ClientConnect =
  1301. {
  1302.     bprint (self.netname);
  1303.     bprint (" entered the game\n");
  1304.  
  1305.     sprint(self, "Welcome to MADGE's Quake Server.\n");
  1306.     
  1307. // a client connecting during an intermission can cause problems
  1308.     if (intermission_running)
  1309.         ExitIntermission ();
  1310. };
  1311.  
  1312.  
  1313. /*
  1314. ===========
  1315. ClientDisconnect
  1316.  
  1317. called when a player disconnects from a server
  1318. ============
  1319. */
  1320. void() ClientDisconnect =
  1321. {
  1322.     if (gameover)
  1323.         return;
  1324.     // if the level end trigger has been activated, just return
  1325.     // since they aren't *really* leaving
  1326.  
  1327.     // let everyone else know
  1328.     bprint (self.netname);
  1329.     bprint (" left the game with ");
  1330.     bprint (ftos(self.frags));
  1331.     bprint (" frags\n");
  1332.     sound (self, CHAN_BODY, "player/tornoff2.wav", 1, ATTN_NONE);
  1333.     set_suicide_frame ();
  1334. };
  1335.  
  1336. /*
  1337. ===========
  1338. ClientObituary
  1339.  
  1340. called when a player dies
  1341. ============
  1342. */
  1343. void(entity targ, entity attacker) ClientObituary =
  1344. {
  1345.     local    float rnum;
  1346.     local    string deathstring, deathstring2;
  1347.     rnum = random();
  1348.  
  1349.     if (targ.classname == "player")
  1350.     {
  1351.         if (attacker.classname == "teledeath")
  1352.         {
  1353.             bprint (targ.netname);
  1354.             bprint (" was telefragged by ");
  1355.             bprint (attacker.owner.netname);
  1356.             bprint ("\n");
  1357.  
  1358.             attacker.owner.frags = attacker.owner.frags + 1;
  1359.             return;
  1360.         }
  1361.  
  1362.         if (attacker.classname == "teledeath2")
  1363.         {
  1364.             bprint ("Satan's power deflects ");
  1365.             bprint (targ.netname);
  1366.             bprint ("'s telefrag\n");
  1367.  
  1368.             targ.frags = targ.frags - 1;
  1369.             return;
  1370.         }
  1371.  
  1372.         if (attacker.classname == "player")
  1373.         {
  1374.             if (targ == attacker)
  1375.             {
  1376.                 // killed self
  1377.                 attacker.frags = attacker.frags - 1;
  1378.                 bprint (targ.netname);
  1379.                 
  1380.                 if (targ.weapon == 64 && targ.waterlevel > 1)
  1381.                 {
  1382.                     bprint (" discharges into the water.\n");
  1383.                     return;
  1384.                 }
  1385.                 if (targ.weapon == 16)
  1386.                     bprint (" tries to put the pin back in\n");
  1387.                 else if (rnum)
  1388.                     bprint (" becomes bored with life\n");
  1389.                 else
  1390.                     bprint (" checks if his weapon is loaded\n");
  1391.                 return;
  1392.             }
  1393.             else
  1394.             {
  1395.                 attacker.frags = attacker.frags + 1;
  1396.  
  1397.                 rnum = attacker.weapon;
  1398.                 if (rnum == IT_AXE)
  1399.                 {
  1400.                     deathstring = " was ax-murdered by ";
  1401.                     deathstring2 = "\n";
  1402.                 }
  1403.                 if (rnum == IT_SHOTGUN)
  1404.                 {
  1405.                     deathstring = " chewed on ";
  1406.                     deathstring2 = "'s boomstick\n";
  1407.                 }
  1408.                 if (rnum == IT_SUPER_SHOTGUN)
  1409.                 {
  1410.                     deathstring = " ate 2 loads of ";
  1411.                     deathstring2 = "'s buckshot\n";
  1412.                 }
  1413.                 if (rnum == IT_NAILGUN)
  1414.                 {
  1415.                     deathstring = " was nailed by ";
  1416.                     deathstring2 = "\n";
  1417.                 }
  1418.                 if (rnum == IT_SUPER_NAILGUN)
  1419.                 {
  1420.                     deathstring = " was punctured by ";
  1421.                     deathstring2 = "\n";
  1422.                 }
  1423.                 if (rnum == IT_GRENADE_LAUNCHER)
  1424.                 {
  1425.                     deathstring = " eats ";
  1426.                     deathstring2 = "'s pineapple\n";
  1427.                     if (targ.health < -40)
  1428.                     {
  1429.                         deathstring = " was gibbed by ";
  1430.                         deathstring2 = "'s grenade\n";
  1431.                     }
  1432.                 }
  1433.                 if (rnum == IT_ROCKET_LAUNCHER)
  1434.                 {
  1435.                     deathstring = " rides ";
  1436.                     deathstring2 = "'s rocket\n";
  1437.                     if (targ.health < -40)
  1438.                     {
  1439.                         deathstring = " was gibbed by ";
  1440.                         deathstring2 = "'s rocket\n" ;
  1441.                     }
  1442.                 }
  1443.                 if (rnum == IT_LIGHTNING)
  1444.                 {
  1445.                     deathstring = " accepts ";
  1446.                     if (attacker.waterlevel > 1)
  1447.                         deathstring2 = "'s discharge\n";
  1448.                     else
  1449.                         deathstring2 = "'s shaft\n";
  1450.                 }
  1451.                 bprint (targ.netname);
  1452.                 bprint (deathstring);
  1453.                 bprint (attacker.netname);
  1454.                 bprint (deathstring2);
  1455.             }
  1456.             return;
  1457.         }
  1458.         else
  1459.         {
  1460.             targ.frags = targ.frags - 1;        // killed self
  1461.             rnum = targ.watertype;
  1462.  
  1463.             bprint (targ.netname);
  1464.             if (rnum == -3)
  1465.             {
  1466.                 if (random() < 0.5)
  1467.                     bprint (" sleeps with the fishes\n");
  1468.                 else
  1469.                     bprint (" sucks it down\n");
  1470.                 return;
  1471.             }
  1472.             else if (rnum == -4)
  1473.             {
  1474.                 if (random() < 0.5)
  1475.                     bprint (" gulped a load of slime\n");
  1476.                 else
  1477.                     bprint (" can't exist on slime alone\n");
  1478.                 return;
  1479.             }
  1480.             else if (rnum == -5)
  1481.             {
  1482.                 if (targ.health < -15)
  1483.                 {
  1484.                     bprint (" burst into flames\n");
  1485.                     return;
  1486.                 }
  1487.                 if (random() < 0.5)
  1488.                     bprint (" turned into hot slag\n");
  1489.                 else
  1490.                     bprint (" visits the Volcano God\n");
  1491.                 return;
  1492.             }
  1493.  
  1494.             if (attacker.flags & FL_MONSTER)
  1495.             {
  1496.                 if (attacker.classname == "monster_army")
  1497.                     bprint (" was shot by a Grunt\n");
  1498.                 if (attacker.classname == "monster_demon1")
  1499.                     bprint (" was eviscerated by a Fiend\n");
  1500.                 if (attacker.classname == "monster_dog")
  1501.                     bprint (" was mauled by a Rottweiler\n");
  1502.                 if (attacker.classname == "monster_dragon")
  1503.                     bprint (" was fried by a Dragon\n");
  1504.                 if (attacker.classname == "monster_enforcer")
  1505.                     bprint (" was blasted by an Enforcer\n");
  1506.                 if (attacker.classname == "monster_fish")
  1507.                     bprint (" was fed to the Rotfish\n");
  1508.                 if (attacker.classname == "monster_hell_knight")
  1509.                     bprint (" was slain by a Death Knight\n");
  1510.                 if (attacker.classname == "monster_knight")
  1511.                     bprint (" was slashed by a Knight\n");
  1512.                 if (attacker.classname == "monster_ogre")
  1513.                     bprint (" was destroyed by an Ogre\n");
  1514.                 if (attacker.classname == "monster_oldone")
  1515.                     bprint (" became one with Shub-Niggurath\n");
  1516.                 if (attacker.classname == "monster_shalrath")
  1517.                     bprint (" was exploded by a Vore\n");
  1518.                 if (attacker.classname == "monster_shambler")
  1519.                     bprint (" was smashed by a Shambler\n");
  1520.                 if (attacker.classname == "monster_tarbaby")
  1521.                     bprint (" was slimed by a Spawn\n");
  1522.                 if (attacker.classname == "monster_vomit")
  1523.                     bprint (" was vomited on by a Vomitus\n");
  1524.                 if (attacker.classname == "monster_wizard")
  1525.                     bprint (" was scragged by a Scrag\n");
  1526.                 if (attacker.classname == "monster_zombie")
  1527.                     bprint (" joins the Zombies\n");
  1528.  
  1529.                 return;
  1530.             }
  1531.             if (attacker.classname == "explo_box")
  1532.             {
  1533.                 bprint (" blew up\n");
  1534.                 return;
  1535.             }
  1536.             if (attacker.solid == SOLID_BSP && attacker != world)
  1537.             {    
  1538.                 bprint (" was squished\n");
  1539.                 return;
  1540.             }
  1541.             if (targ.deathtype == "falling")
  1542.             {
  1543.                 targ.deathtype = "";
  1544.                 bprint (" fell to his death\n");
  1545.                 return;
  1546.             }
  1547.             if (attacker.classname == "trap_shooter" || attacker.classname == "trap_spikeshooter")
  1548.             {
  1549.                 bprint (" was spiked\n");
  1550.                 return;
  1551.             }
  1552.             if (attacker.classname == "fireball")
  1553.             {
  1554.                 bprint (" ate a lavaball\n");
  1555.                 return;
  1556.             }
  1557.             if (attacker.classname == "trigger_changelevel")
  1558.             {
  1559.                 bprint (" tried to leave\n");
  1560.                 return;
  1561.             }
  1562.  
  1563.             bprint (" died\n");
  1564.         }
  1565.     }
  1566. };
  1567.